<!doctype html>
<html class="no-js fixed-layout" data-ng-app="audittest">
#include("/WEB-INF/tpl/head.vm")
<div data-ng-controller="admin-plan">
    <div class="am-cf am-padding">
        <div class="am-fl am-cf">
            <strong class="am-text-primary am-text-lg">首页</strong> /
            <small>考试计划管理</small>
        </div>
    </div>
    <div data-ng-hide="addoredit">
        <div class="am-form">
            <button type="button" class="am-btn am-btn-default" data-ng-click="add()">新增计划</button>
            年度:
            <select data-ng-options="nd for nd in nds" data-am-selected="{btnSize: 'sm'}" data-ng-model="qnd"></select>
            &nbsp; 序列:
            <select data-ng-options="a.seqbh as a.seqname for a in seqs" data-am-selected="{btnSize: 'sm'}"
                    data-ng-model="qseq"></select>
            &nbsp; 分类:
            <select data-ng-options="a.catebh as a.catename for a in cates" data-am-selected="{btnSize: 'sm'}"
                    data-ng-model="qcate"></select>
            &nbsp;
            <button type="button" class="am-margin-right am-btn am-btn-search" data-ng-click="search()">检索</button>
        </div>
        <div class="am-scrollable-horizontal">
            <table class="am-table am-text-nowrap am-table-bd am-table-striped admin-content-table">
                <thead>
                <tr>
                    <th>序号</th>
                    <th>计划名称</th>
                    <th>计划年度</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <tr data-ng-repeat="item in items">
                    <td>{{$index + 1}}</td>
                    <td>{{item.modelname}}</td>
                    <td>{{item.year}}</td>
                    <td>
                        <div data-ng-hide="item.enabled">
                            <button type="button" class="am-btn am-btn-primary" data-ng-click="edit(item)">编辑</button>
                            <button type="button" class="am-btn am-btn-primary" data-ng-click="view(item)"
                                    data-ng-show="item.builded==1">查看试卷
                            </button>
                            <button type="button" class="am-btn am-btn-primary" data-ng-click="rebuild(item)"
                                    data-ng-show="item.builded==1">重新生成试卷
                            </button>
                            <button type="button" class="am-btn am-btn-primary" data-ng-click="build(item)"
                                    data-ng-show="item.builded==0">生成试卷
                            </button>
                            <button type="button" class="am-btn am-btn-danger" data-ng-click="deleteItem(item)">作废
                            </button>
                            <button type="button" class="am-btn am-btn-secondary" data-ng-click="cloneItem(item)">克隆
                            </button>
                        </div>
                        <div data-ng-show="item.enabled">
                            该考试已经作废
                            <button type="button" class="am-btn am-btn-danger" data-ng-click="deleteModel(item)">彻底删除
                            </button>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <div data-ng-show="addoredit">
        <div class="am-modal-bd am-form am-form-horizontal">
            <div class="am-fl am-cf">
                <strong class="am-text-primary am-text-lg">新增/编辑考试计划</strong>
            </div>
            <div>
                <table class="am-table am-table-bd am-table-striped admin-content-table">
                    <tr>
                        <td>计划编号</td>
                        <td>
                            <input data-ng-model="currentItem.modelbh" type="text" readonly="readonly"/>
                        </td>
                    </tr>
                    <tr>
                        <td>计划名称</td>
                        <td>
                            <input data-ng-model="currentItem.modelname" type="text"/>
                        </td>
                    </tr>
                    <tr>
                        <td>计划年度</td>
                        <td>
                            <select data-ng-options="nd for nd in nds" data-ng-model="currentItem.year"></select>
                        </td>
                    </tr>
                    <tr>
                        <td>考试时间（分钟）</td>
                        <td>
                            <input type="number" data-ng-model="currentItem.minutes"/>
                        </td>
                    </tr>
                    <tr>
                        <td>所属序列</td>
                        <td>
                            <select data-ng-options="seq.seqbh as seq.seqname for seq in seqs"
                                    data-ng-model="currentItem.seqbh"></select>
                        </td>
                    </tr>
                    <tr>
                        <td>所属分类</td>
                        <td>
                            <select data-ng-options="cate.catebh as cate.catename for cate in cates"
                                    data-ng-model="currentItem.catebh"></select>
                        </td>
                    </tr>
                    <tr>
                        <td>备注</td>
                        <td>
                            <textarea cols="20" rows="2" data-ng-model="currentItem.remark"></textarea>
                        </td>
                    </tr>
                </table>
                <hr/>
                <div class="am-fl am-cf">
                    <small class="am-text-primary am-text-lg">考题明细</small>
                    <button type="button" class="am-btn am-btn-primary" data-ng-click="addDetail()">+</button>
                    &nbsp;
                    <button type="button" class="am-btn am-btn-info" data-ng-click="calcScore()">计算题目合计分数</button>
                </div>
                <table class="am-table am-table-bd am-table-striped admin-content-table">
                    <tr style="text-align: center">
                        <th style="text-align: center">序号</th>
                        <th style="text-align: center">题目类型</th>
                        <th style="text-align: center">题目序列</th>
                        <th style="text-align: center">题目分类</th>
                        <th style="text-align: center">题目数量</th>
                        <th style="text-align: center">每题分数</th>
                        <th style="text-align: center">题目难度</th>
                        <th></th>
                    </tr>
                    <tr data-ng-repeat="a in currentDetails">
                        <td style="width:50px;">{{$index + 1}}</td>
                        <td style="width:80px;">
                            <select data-ng-options="type for type in types" data-ng-model="a.itemtype"></select>
                        </td>
                        <td style="width:80px;">
                            <select data-ng-options="seq.seqbh as seq.seqname for seq in seqs"
                                    data-ng-model="a.seqbh"></select>
                        </td>
                        <td style="width:100px;">
                            <select data-ng-options="cate.catebh as cate.catename for cate in cates"
                                    data-ng-model="a.catebh"></select>
                        </td>
                        <td style="width:60px;">
                            <input type="number" data-ng-model="a.itemcount"/>
                        </td>
                        <td style="width:50px;">
                            <input type="number" data-ng-model="a.score"/>
                        </td>
                        <td style="width:80px;">
                            <select data-ng-options="l.value as l.label for l in difficulties"
                                    data-ng-model="a.itemlevel"></select>
                        </td>
                        <td style="width:200px;">
                            <button type="button" class="am-btn am-btn-success" data-ng-click="getItemCount(a)">题目数量
                            </button>
                            &nbsp;&nbsp;
                            <button type="button" class="am-btn am-btn-danger" data-ng-click="deleteDetail($index)">删除
                            </button>
                        </td>
                    </tr>
                </table>
            </div>
            <button type="button" class="am-btn am-btn-primary" data-ng-click="postData()">提交</button>
            &nbsp;&nbsp;&nbsp;&nbsp;
            <button type="button" class="am-btn am-btn-cancel" data-ng-click="cancel()">取消</button>
        </div>
    </div>
</div>

#include("/WEB-INF/tpl/footer.vm")

</html>